﻿<UserControl x:Class="CCT.NUI.TestDataCollector.HandDisplayControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <BooleanToVisibilityConverter x:Key="BoolVisibilityConverter"/>
        <Style x:Key="FingerStyle" TargetType="Ellipse">
            <Style.Triggers>
                <DataTrigger Binding="{Binding Path=IsSelected}" Value="False">
                    <Setter Property="Fill" Value="Orange" />
                </DataTrigger>
                <DataTrigger Binding="{Binding Path=IsSelected}" Value="True">
                    <Setter Property="Fill" Value="Yellow" />
                </DataTrigger>
            </Style.Triggers>
        </Style>
        <Style x:Key="HandStyle" TargetType="Ellipse">
            <Style.Triggers>
                <DataTrigger Binding="{Binding Path=IsSelected}" Value="False">
                    <Setter Property="Fill" Value="Purple" />
                </DataTrigger>
                <DataTrigger Binding="{Binding Path=IsSelected}" Value="True">
                    <Setter Property="Fill" Value="Yellow" />
                </DataTrigger>                
            </Style.Triggers>
        </Style>
    </UserControl.Resources>
    <Canvas>
        <Ellipse Style="{StaticResource HandStyle}" Canvas.Left="{Binding Path=PalmLeft}" Canvas.Top="{Binding Path=PalmTop}" Width="10" Height="10" Margin="-5" Stroke="Black" Visibility="{Binding Path=HasPalmPoint, Converter={StaticResource BoolVisibilityConverter}}" IsHitTestVisible="False"/>
        <ItemsControl ItemsSource="{Binding Path=FingerPoints}">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <Canvas />
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Ellipse Style="{StaticResource FingerStyle}" Stroke="Black"  Margin="-5" IsHitTestVisible="False"/>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
            <ItemsControl.ItemContainerStyle>
                <Style TargetType="ContentPresenter">
                    <Setter Property="Canvas.Left" Value="{Binding Path=X}" />
                    <Setter Property="Canvas.Top" Value="{Binding Path=Y}" />
                </Style>
            </ItemsControl.ItemContainerStyle>
        </ItemsControl>
    </Canvas>
</UserControl>
